//
//  SpacerDemo.swift
//  firstFontAttrDemo
//
//  Created by liy on 2025/1/22.
//

import SwiftUI

struct SpacerDemo: View {
  var body: some View {
		VStack(alignment:.center,spacing: 5) {
      // flex: space-between
      VStack {
        Rectangle()
          .frame(width: 60, height: 60)

        Spacer()

        Rectangle()
          .frame(width: 80, height: 60)

        Spacer()

        Rectangle()
          .frame(width: 60, height: 60)
      }
      .frame(width: 100, height: 240, alignment: .center)
      .background(.red)
			
      // flex: space-around
      VStack {
        Spacer()
        Rectangle()
          .frame(width: 60, height: 60)
        Spacer()
        Spacer()
        Rectangle()
          .frame(width: 80, height: 60)
        Spacer()
        Spacer()
        Rectangle()
          .frame(width: 60, height: 60)
        Spacer()
      }
      .frame(width: 100, height: 240, alignment: .center)
      .background(.red)

      // flex: space-evenly
      VStack {
        Spacer()
        Rectangle()
          .frame(width: 60, height: 60)

        Spacer()

        Rectangle()
          .frame(width: 80, height: 60)

        Spacer()

        Rectangle()
          .frame(width: 60, height: 60)

        Spacer()
      }
      .frame(width: 100, height: 240, alignment: .center)
      .background(.red)
    }
  }
}

#Preview {
  SpacerDemo()
}
